package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Tel      string `gorm:"type:char(11)"`
	Password string `gorm:"type:varchar(32)"`
}

type New struct {
	gorm.Model
	Title        string `gorm:"type:varchar(60)"`
	Content      string `gorm:"type:text"`
	Img          string `gorm:"type:varchar(255)"`
	LikeCount    int    `gorm:"type:int"`
	CommentCount int    `gorm:"type:int"`
	UserId       int    `gorm:"type:int"`
	User         User   `gorm:"foreignerKey:UserId"`
}

type Like struct {
	gorm.Model
	UserId int  `gorm:"type:int"`
	User   User `gorm:"foreignerKey:UserId"`
	NewId  int  `gorm:"type:int"`
	New    New  `gorm:"foreignerKey:News"`
}

type Comment struct {
	gorm.Model
	Content string `gorm:"type:text"`
	UserId  int    `gorm:"type:int"`
	User    User   `gorm:"foreignerKey:UserId"`
	NewId   int    `gorm:"type:int"`
	New     New    `gorm:"foreignerKey:News"`
}
